package com.wodwl.entity;

import java.util.Date;

import org.json.JSONException;
import org.json.JSONObject;

public class Resource {
	private int rid;
	private int pid;
	private String name;
	private String store_relative_path;
	private String orgi_file_name;
	private String owner;
	private long create_time;
	private long last_modify_time;
	private int type;
	private int category;
	private String tag="";
	private int score;
	private String description="";
	private String size="";
	private int download_count;
	private String path;//路径，便于级联删除，如a-1a1a12，不包括自己的id
	private int status;//是否删除
	private int share;
	public JSONObject toJsonObject() throws JSONException{
		JSONObject object=new JSONObject();
		object.put("rid",rid);
		object.put("pid",pid);
		object.put("name",name);
		object.put("store_relative_path",store_relative_path);
		object.put("orgi_file_name",orgi_file_name);
		object.put("owner",owner);
		object.put("create_time",create_time);
		object.put("last_modify_time", last_modify_time);
		object.put("type",type);
		object.put("category",category);
		object.put("tag",tag);
		object.put("score",score);
		object.put("description",description);
		object.put("size",size);
		object.put("download_count",download_count);
		object.put("path", path);
		object.put("status", status);
		return object;
	}
	public static class TypeIndex{
		public static final int TXT=0;
		public static final int WORD=1;
		public static final int EXCEL=2;
		public static final int PPT=3;
		public static final int FOLDER=4;
		public static final int PICTURE=5;
		public static final int MUSIC=6;
		public static final int MOVIE=7;
		public static final int WAR=8;
		public static final int OTHER=9;
	}
	public static String[] TypeName={
		"txt",
		"word",
		"excel",
		"ppt",
		"folder",
		"pic",
		"music",
		"movie",
		"war",
		"other"
	};
	
	//系统固定分类
	public static class Category{
		public static final int Technogly=1;//技术
		public static final int Paper=2;//论文
		public static final int Counseling=3;//辅导
		public static final int Entertainment=4;//娱乐
		public static final int Other=5;//其它
	}
	public static class Status{
		public static final int Nomal=1;//正常
		public static final int DeleteByOwner=-1;//被作者删除，放在垃圾箱中
		public static final int DeleteCascade=-2;//被系统管理员删除，考虑到盗版
		public static final int DeleteByAdamin=-3;//由于父节点被删除导致该节点被删除
		public static final int Deleted=-4;//由于清空垃圾回收站，被永久删除的，或垃圾回收站超过30天的被系统自动删除，可恢复
	}
	public static class Share{
		public static final int NoShare=0;
		public static final int Shared=1;
	}
	public int getRid() {
		return rid;
	}
	public void setRid(int rid) {
		this.rid = rid;
	}
	
	public int getPid() {
		return pid;
	}
	public void setPid(int pid) {
		this.pid = pid;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	
	public String getOwner() {
		return owner;
	}
	public void setOwner(String owner) {
		this.owner = owner;
	}
	
	
	public long getCreate_time() {
		return create_time;
	}
	public void setCreate_time(long create_time) {
		this.create_time = create_time;
	}
	public long getLast_modify_time() {
		return last_modify_time;
	}
	public void setLast_modify_time(long last_modify_time) {
		this.last_modify_time = last_modify_time;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	
	public int getCategory() {
		return category;
	}
	public void setCategory(int category) {
		this.category = category;
	}
	public String getTag() {
		return tag;
	}
	public void setTag(String tag) {
		this.tag = tag;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getSize() {
		return size;
	}
	public void setSize(String size) {
		this.size = size;
	}
	public int getDownload_count() {
		return download_count;
	}
	public void setDownload_count(int download_count) {
		this.download_count = download_count;
	}
	public String getStore_relative_path() {
		return store_relative_path;
	}
	public void setStore_relative_path(String store_relative_path) {
		this.store_relative_path = store_relative_path;
	}
	public String getOrgi_file_name() {
		return orgi_file_name;
	}
	public void setOrgi_file_name(String orgi_file_name) {
		this.orgi_file_name = orgi_file_name;
	}
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public static String[] getTypeName() {
		return TypeName;
	}
	public static void setTypeName(String[] typeName) {
		TypeName = typeName;
	}
	public int getShare() {
		return share;
	}
	public void setShare(int share) {
		this.share = share;
	}
	
	
	
}
